package com.settlement.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.settlement.system.common.result.PageResult;
import com.settlement.system.common.result.Result;
import com.settlement.system.model.query.BillPageQuery;
import com.settlement.system.model.vo.SysBillVO;
import com.settlement.system.service.SysBillService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 标准账单 前端控制器
 * </p>
 *
 * @author huangrensen
 * @since 2023-08-05
 */
@Tag(name = "标准账单")
@RestController
@RequestMapping("/api/v1/bill")
@RequiredArgsConstructor
public class SysBillController {

    private final SysBillService sysBillService;

    @Operation(summary = "标准账单分页列表", security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/page")
    public PageResult<SysBillVO> getBillPage(@ParameterObject BillPageQuery queryParams) {
        Page<SysBillVO> result = sysBillService.getBillPage(queryParams);
        return PageResult.success(result);
    }

    @Operation(summary = "标准账单字段列表", security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/columnList")
    public Result<?> columnList() {
        return Result.success(sysBillService.columnList());
    }
}
